package com.tan.androidtest.drawable;

import android.graphics.drawable.ClipDrawable;
import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;

import com.tan.androidtest.R;
import com.tan.androidtest.base.BaseActivity;

import butterknife.BindView;

/**
 * 测试ClipDrawable 顺便测试SeekBar
 * (可拖动的进度条)
 */

public class TestClipDrawableActivity extends BaseActivity {


    @BindView(R.id.tv_test)
    TextView mTvTest;
    @BindView(R.id.sb_test)
    SeekBar mSbTest;
    @BindView(R.id.iv_test_clip)
    ImageView mIvTestClip;

    @Override
    public int initLayoutId() {
        return R.layout.activity_test_clip_drawable_layout;
    }

    @Override
    public void initTitle(TextView tv_bar_left, TextView tv_bar_title, TextView tv_bar_right) {
        tv_bar_title.setText("测试ClipDrawable 顺便测试SeekBar");
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {
        mSbTest.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
            @Override
            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                ClipDrawable clipDrawable = (ClipDrawable) mIvTestClip.getBackground();
                clipDrawable.setLevel(progress * 100);
            }

            @Override
            public void onStartTrackingTouch(SeekBar seekBar) {

            }

            @Override
            public void onStopTrackingTouch(SeekBar seekBar) {

            }
        });
    }


}
